home *** CD-ROM | disk | FTP | other *** search
- <!---
-
- Template: SyntaxCheck.cfm
- Author: Simeon Simeonov
-
- Source Control: $Header: /ColdFusion/Docs/syntaxcheck.cfm 3 8/19/98 3:51p Ereiber $
-
- CF_SyntaxCheck:
-
- Checks a directory tree of cold fusion templates for syntax errors
- and returns a query with two columns: (TemplatePath, ErrorMessage).
- Every row of the query gives the full path to a template that
- failed the syntax check and the error message.
-
- Usage:
-
- <CF_SyntaxCheck Directory=... Filter=... Recurse=... ResultQuery=...>
-
- Attributes:
-
- Directory (required, string)
- The root of the directory tree for syntax checking, for example, "c:\wwwroot"
-
- Filter (optional, string, default: *.cfm)
- Filter (search specifdication) to use for file checking. You may want
- to use *.?fm (to match .cfm and old style .dbm files).
-
- Recurse (optional, boolean, default: true)
- Determines whether a recursive directory search is performed.
-
- ResultQuery (required, variable name)
- The name of the query that the tag creates in the caller scope.
-
- --->
-
- <!---
- Validate attribute set
- --->
-
- <cfparam name="attributes.directory">
- <cfparam name="attributes.filter" default="*.cfm">
- <cfparam name="attributes.recurse" default=true>
- <cfparam name="attributes.resultquery">
-
- <!---
- Get a list of the files
- --->
-
- <CF_DirectoryList
- directory=#attributes.directory#
- filter=#attributes.filter#
- recurse=#attributes.recurse#
- resultQuery=fileList>
-
- <!---
- Iterate over the list of files and perform a syntax check
- --->
-
- <cfset resultQuery = QueryNew("TemplatePath, ErrorMessage")>
- <cfloop query=fileList>
- <cfif type is not "Dir">
- <cfinternaldebug action=pcode templatePath=#path# outVar=msg>
- <cfif msg is not "">
- <!--- syntax check error --->
- <cfset temp = queryAddRow(resultQuery)>
- <cfset temp = querySetCell(resultQuery, "TemplatePath", path)>
- <cfset temp = querySetCell(resultQuery, "ErrorMessage", msg)>
- </cfif>
- </cfif>
- </cfloop>
-
- <!---
- Set resulting query
- --->
-
- <cfset "Caller.#attributes.resultQuery#" = resultQuery>
-
-
-
-
-
-